#ifndef QUANT_H
#define QUANT_H
#include <stdint.h>
#include "common.h"

typedef struct
{
    // 量化矩阵三维数组，最后16代表4x4矩阵中的16个像素点
    udctcoef quant4_mf[CQM_BUTT][QP_MAX_SPEC + 1][16];
    udctcoef quant4_bias[CQM_BUTT][QP_MAX_SPEC + 1][16];
    udctcoef quant4_bias0[CQM_BUTT][QP_MAX_SPEC + 1][16];

    int dequant4_mf[CQM_BUTT][QP_MAX_SPEC + 1][16];
    int unquant4_mf[CQM_BUTT][QP_MAX_SPEC + 1][16];

}quant_t;

int h264_cqm_init(quant_t *quant, int sps_scaling);
int quant_4x4x4(dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
void dequant_4x4(dctcoef dct[16], int dequant_mf[6][16], int i_qp);
int quant_4x4_dc(dctcoef dct[16], int mf, int bias);
void dequant_4x4_dc(dctcoef dct[16], int dequant_mf[6][16], int i_qp);
int quant_2x2_dc( dctcoef dct[4], int mf, int bias );
void idct_dequant_2x2_dc(dctcoef dct[4], dctcoef dct4x4[4][16], int dequant_mf[6][16], int i_qp);
#endif